package main

import "fmt"

func main() {
	//声明&初始化
	var students00 [6][8]string
	students01 := [...][2]string{{"sf", "woniu"}, {"ada", "wd"}, {"雪糕", "小林"}} //多维数组只有第一维长度可使用变量数量推测
	students02 := [3][3]string{{"sf", "woniu", "ada"}, {"wd"}, {"雪糕", "小林"}}
	students03 := [3][3]string{0: {"sf", "woniu", "ada"}, 2: {"wd", "雪糕", "小林"}}
	students04 := [3][3]string{0: {0: "sf", 2: "woniu"}, 2: {1: "wd", 2: "雪糕"}}

	fmt.Printf("%T,%T,%T,%T,%T\n", students00, students01, students02, students03, students04)
	fmt.Printf("%q\n", students00)
	fmt.Printf("%q\n", students01)
	fmt.Printf("%q\n", students02)
	fmt.Printf("%q\n", students03)
	fmt.Printf("%q\n", students04)

	// 访问元素
	fmt.Printf("%q\n", students01[1])
	fmt.Println(students01[0][0])

	// 修改元素
	students01[1] = [2]string{"无敌", "卧底"}
	students01[0][0] = "aa"
	fmt.Printf("%q\n", students01)

	// 遍历元素
	for i := 0; i < len(students01); i++ {
		for j := 0; j < len(students01[i]); j++ {
			fmt.Printf("[%d, %d]: %q\n", i, j, students01[i])
		}
	}

	for i, line := range students01 {
		for j, v := range line {
			fmt.Printf("[%d, %d]: %q\n", i, j, v)
		}
	}
}
